<?php
/**
 * Created by PhpStorm.
 * User: adminstrator
 * Date: 2018/2/8
 * Time: 16:35
 */
header("Content-type:text/html;charset=utf-8");
date_default_timezone_set('PRC');
include_once("./Db_pdo.class1.php");
echo '<pre>';
$DB1=new Db_pdo("newcxh","admin","2018126");

// //代理商返款记录
//  $agent_day = $DB1->table("back")->field('back_id,user_id,back_points,total_points,no_points,back_state,ratio,user_name,time')->select();
//  // print_r($agent_day);
//  file_put_contents('agent_day.txt',serialize($agent_day));

//  // //计算代理商返款天数
// $sqls1 = 'select count(1) as num,user_id   from back_buy WHERE `status`=1  GROUP BY user_id';

// $agent_cday = $DB1->new_query($sqls1);
// $agent_cday = $agent_cday->fetchAll(PDO::FETCH_ASSOC);  
// // print_r($ticket_day);
// file_put_contents('agent_cday.txt',serialize($agent_cday));




// //这里开始截断
// //门票日志(查询带有日期的)
// $sqls2 = 'select  b.*,t.id from back_buy as b left join ticket as t on b.user_id=t.user_id where b.status=2 ';
// $ticket_log1 = $DB1->new_query($sqls2);
// $ticket_log1 = $ticket_log1->fetchAll(PDO::FETCH_ASSOC);  

//  file_put_contents('ticket_log.txt',serialize($ticket_log1));

// //  //提现列表()
// $sqls3 = 'select * from withdraw';
// $user_cash = $DB1->new_query($sqls3);
// $user_cash = $user_cash->fetchAll(PDO::FETCH_ASSOC);  

//  file_put_contents('user_cash.txt',serialize($user_cash));



// //直推 间推历史
// $sqls4 = 'SELECT pay_points,tax,money,datetime,uid,no_points FROM pay_info WHERE `status` in(1,2)';
// $zhitui_log = $DB1->new_query($sqls4);
// $zhitui_log = $zhitui_log->fetchAll(PDO::FETCH_ASSOC);  

// file_put_contents('zhitui_log.txt',serialize($zhitui_log)); 

// //车辆销售 直推间推历史
// $sqls5 = 'SELECT pay_points,tax,money,datetime,uid,no_points FROM pay_info WHERE `status` in(5,6)';
// $car_zhitui_log = $DB1->new_query($sqls5);
// $car_zhitui_log = $car_zhitui_log->fetchAll(PDO::FETCH_ASSOC);  

// file_put_contents('car_zhitui_log.txt',serialize($car_zhitui_log)); 

 
//  //礼包等级差
// $sqls6 = 'SELECT pay_points,tax,money,datetime,uid,no_points FROM pay_info WHERE `status` =3';
// $jicha_log = $DB1->new_query($sqls6);
// $jicha_log = $jicha_log->fetchAll(PDO::FETCH_ASSOC);  

// file_put_contents('jicha_log.txt',serialize($jicha_log)); 

//  //礼包报单
// $sqls7 = 'SELECT pay_points,tax,money,datetime,uid,no_points FROM pay_info WHERE `status` =4';
// $baodan_log = $DB1->new_query($sqls7);
// $baodan_log = $baodan_log->fetchAll(PDO::FETCH_ASSOC);  

// file_put_contents('baodan_log.txt',serialize($baodan_log)); 


// //礼包收钱记录
// $sqls8 = "SELECT * FROM ulist WHERE act in('定金加盟','会员升级')";
// $money_log = $DB1->new_query($sqls8);
// $money_log = $money_log->fetchAll(PDO::FETCH_ASSOC);  

// file_put_contents('money_log.txt',serialize($money_log)); 



// 获取差值 


// $oldsql = "SELECT
// 	user_id,need_back,FROM_UNIXTIME(back_time,'%Y-%m-%d') as time1
// FROM
// 	back_buy
// WHERE
// 	STATUS = 1
// AND back_time BETWEEN 1533830400 
// AND 1533916559
// ORDER BY user_id ASC";
// $oldcar = $DB1->new_query($oldsql);
// $oldcar = $oldcar->fetchAll(PDO::FETCH_ASSOC);  

// file_put_contents('oldcar.txt',serialize($oldcar)); 
// print_r($oldcar);





 
























